<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <include file="Public:header" />
  <!--[if lt IE 9]>
    <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>
<body>
  <include file="Public:body_top" />

  <div class="container-fluid">
    <div class="row">
      <div class="col-sm-3 col-md-2 sidebar hidden-xs">
        <div class="menu">
          <dl>
            <dt><i class="cm-order"></i>小程序</dt>
            <dd><a href="{:U('Apps/xcx_edit')}">小程序配置</a></dd>
            <dd><a href="{:U('Apps/xcx_edit')}&tpl=xcx_msg_edit">小程序模板消息</a></dd>
            <dd class="active"><a href="{:U('Apps/xcx_edit')}&tpl=storage">存储配置</a></dd>
            <dd><a href="{:U('Apps/xcx_edit')}&tpl=sms">短信配置</a></dd>
            <dd><a href="{:U('Apps/xcx_edit')}&tpl=withdraw">提现配置</a></dd>
            <dd><a href="{:U('Mode/index')}">首页模式图标</a></dd>
          </dl>
          <dl>
            <dt><i class="cm-advert"></i>广告管理</dt>
            <dd><a href="{:U('Adverts/index')}">广告列表</a></dd>
            <dd><a href="{:U('Adverts/add')}">新建广告</a></dd>
          </dl>
          <dl>
            <dt><i class="icon-uniE611"></i>帮助管理</dt>
            <dd><a href="{:U('Helps/index')}">帮助列表</a></dd>
            <dd><a href="{:U('Helps/add')}">新建帮助</a></dd>
          </dl>
        </div>
      </div>
      <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <div class="main-hd">
          <h5>{$title}</h5>
        </div>

        <div class="main-bd">
          <div class="form-box">
            <form class="form-horizontal" method="post" action="{:U('Apps/xcx_update')}">
              <div class="form-group">
                <label class="col-sm-2 control-label">当前储存类型</label>
                <div class="col-sm-3">
                  <select name="storage_type" onChange="changeType(this)" class="form-control">
                    <option value="1" <if condition="$app.storage_type eq 1">selected</if>>又拍云</option>
                    <option value="2" <if condition="$app.storage_type eq 2">selected</if>>阿里云OSS</option>
                    <option value="3" <if condition="$app.storage_type eq 3">selected</if>>七牛</option>
                  </select>
                  <p class="help-block">填写一项即可</p>
                </div>
              </div>
              <div id="types-1" class="storage-sets <if condition=" $app.storage_type eq 1 ">active</if>">
                <div class="form-group">
                  <label class="col-sm-2 control-label">又拍云Host</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="upyun_host" id="upyun_host" value="{$app.upyun_host}">
                  </div>
                  <label class="col-sm-2 control-label">又拍云Bucket</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="upyun_bucket" id="upyun_bucket" value="{$app.upyun_bucket}">
                  </div>
                </div>

                <div class="form-group">
                  <label class="col-sm-2 control-label">又拍云操作员</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="upyun_username" id="upyun_username" value="{$app.upyun_username}">
                  </div>
                  <label class="col-sm-2 control-label">又拍云操作员密码</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="upyun_password" id="upyun_password" value="{$app.upyun_password}">
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label">又拍云Endpoint</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="upyun_endpoint" id="upyun_endpoint" value="{$app.upyun_endpoint}">
                  </div>
                </div>
              </div>

              <div id="types-2" class="storage-sets <if condition=" $app.storage_type eq 2 ">active</if>">
                <div class="form-group">
                  <label class="col-sm-2 control-label">OSS Domain</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="oss_domain" value="{$app.oss_domain}">
                  </div>
                  <label class="col-sm-2 control-label">OSS Bucket</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="oss_bucket" value="{$app.oss_bucket}">
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label">AccessKeyId</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="oss_key" value="{$app.oss_key}">
                  </div>

                  <label class="col-sm-2 control-label">AccessKeySecret</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="oss_secret" value="{$app.oss_secret}">
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label">OSS Endpoint</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="oss_endpoint" value="{$app.oss_endpoint}">
                  </div>
                </div>
              </div>

              <div id="types-3" class="storage-sets <if condition=" $app.storage_type eq 3 ">active</if>">
                <div class="form-group">
                  <label class="col-sm-2 control-label">七牛 Domain</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="qiniu_domain" value="{$app.qiniu_domain}">
                  </div>
                  <label class="col-sm-2 control-label">七牛 Bucket</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="qiniu_bucket" value="{$app.qiniu_bucket}">
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label">七牛 AccessKey</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="qiniu_accesskey" value="{$app.qiniu_accesskey}">
                  </div>
                  <label class="col-sm-2 control-label">七牛 SecretKey</label>
                  <div class="col-sm-3">
                    <input type="text" class="form-control" name="qiniu_secretkey" value="{$app.qiniu_secretkey}">
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label">七牛 存储区域</label>
                  <div class="col-sm-3">
                    <select name="qiniu_area" class="form-control">
                      <option value="1" <if condition="$app.qiniu_area eq 1">selected</if>>华东</option>
                      <option value="2" <if condition="$app.qiniu_area eq 2">selected</if>>华北</option>
                      <option value="3" <if condition="$app.qiniu_area eq 3">selected</if>>华南</option>
                      <option value="4" <if condition="$app.qiniu_area eq 4">selected</if>>北美</option>
                    </select>
                  </div>
                </div>
              </div>

              <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                  <input type="hidden" name="id" value="{$app.id}">
                  <input type="hidden" name="tpl" value="{$tpl}">
                  <input type="submit" class="btn btn-primary" value="提交">
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>

<script type="text/javascript">
  function changeType(e) {
    var types = e.value;
    $(".storage-sets.active").removeClass("active");
    $("#types-" + types).addClass("active");
  }
</script>

</html>